﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DVSProject.Models.AccessModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    PROCEDURE
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(function () {

            var pointProcedureRemarkI = parseInt($('#ProcedureRemarkPointI').val());
            var pointProcedureRemarkII = parseInt( $('#ProcedureRemarkPointII').val());
            var pointProcedureRemarkIII = parseInt( $('#ProcedureRemarkPointIII').val());
            var pointProcedureRemarkIV = parseInt($('#ProcedureRemarkPointIV').val());
            var pointProcedureRemarkV = parseInt($('#ProcedureRemarkPointV').val());

            TotalPoint();
            GetProcedureRemarkI(false, pointProcedureRemarkI);
            GetProcedureRemarkII(false, pointProcedureRemarkII);
            GetProcedureRemarkIII(false, pointProcedureRemarkIII);
            GetProcedureRemarkIV(false, pointProcedureRemarkIV);
            GetProcedureRemarkV(false, pointProcedureRemarkV);

            $('#ProcedureCheckI').change(function () {

                var isChecked = $('#ProcedureCheckI:checked').val() ? true : false;
                if (isChecked) {
                    pointProcedureRemarkI += 1;
                } else {
                    pointProcedureRemarkI -= 1;
                }
                $('#ProcedureRemarkPointI').val(pointProcedureRemarkI);
                TotalPoint();

                if (pointProcedureRemarkI == 1) {
                    GetProcedureRemarkI(false, pointProcedureRemarkI);
                } else {
                    GetProcedureRemarkI(true, pointProcedureRemarkI);
                }
            });

            $('#ProcedureCheckII').change(function () {
                var isChecked = $('#ProcedureCheckII:checked').val() ? true : false;
                if (isChecked) {
                    pointProcedureRemarkII += 1;
                } else {
                    pointProcedureRemarkII -= 1;
                }
                $('#ProcedureRemarkPointII').val(pointProcedureRemarkII);
                TotalPoint();

                if (pointProcedureRemarkII == 1) {
                    GetProcedureRemarkII(false, pointProcedureRemarkII);
                } else {
                    GetProcedureRemarkII(true, pointProcedureRemarkII);
                }
            });

            $('#ProcedureCheckIII').change(function () {
                var isChecked = $('#ProcedureCheckIII:checked').val() ? true : false;
                if (isChecked) {
                    pointProcedureRemarkIII += 1;
                } else {
                    pointProcedureRemarkIII -= 1;
                }
                $('#ProcedureRemarkPointIII').val(pointProcedureRemarkIII);
                TotalPoint();

                if (pointProcedureRemarkIII == 1) {
                    GetProcedureRemarkIII(false, pointProcedureRemarkIII);
                } else {
                    GetProcedureRemarkIII(true, pointProcedureRemarkIII);
                }
            });

            $('#ProcedureCheckIV').change(function () {
                var isChecked = $('#ProcedureCheckIV:checked').val() ? true : false;
                if (isChecked) {
                    pointProcedureRemarkIV += 1;
                } else {
                    pointProcedureRemarkIV -= 1;
                }
                $('#ProcedureRemarkPointIV').val(pointProcedureRemarkIV);
                TotalPoint();

                if (pointProcedureRemarkIV == 1) {
                    GetProcedureRemarkIV(false, pointProcedureRemarkIV);
                } else {
                    GetProcedureRemarkIV(true, pointProcedureRemarkIV);
                }
            });

            $('#ProcedureCheckV').change(function () {
                var isChecked = $('#ProcedureCheckV:checked').val() ? true : false;
                if (isChecked) {
                    pointProcedureRemarkV += 1;
                } else {
                    pointProcedureRemarkV -= 1;
                }
                $('#ProcedureRemarkPointV').val(pointProcedureRemarkV);
                TotalPoint();

                if (pointProcedureRemarkV == 1) {
                    GetProcedureRemarkV(false, pointProcedureRemarkV);
                } else {
                    GetProcedureRemarkV(true, pointProcedureRemarkV);
                }
            });

            function TotalPoint() {
                $("#TotalPoint").val(parseInt(pointProcedureRemarkI) + parseInt(pointProcedureRemarkII) + parseInt(pointProcedureRemarkIII) + parseInt(pointProcedureRemarkIV) + parseInt(pointProcedureRemarkV));
            }


            function GetProcedureRemarkI(isFilter, point) {
                var actionUrl = '<%=Url.Action("ProcedureRemarkIProcess","Access") %>'
                $.ajax({
                    type: "GET",
                    url: actionUrl,
                    contentType: "application/json; charset=utf-8",
                    data: ({ isFitter: isFilter }),
                    success: function (data) {

                        $("#ProcedureRemarkI").html(data);

                        if (point < 1) {
                            $('#ProcedureRemarksI').removeAttr("disabled");
                        }
                    },
                    error: function (data) {
                        alert(data);
                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                    }
                });
            }

            function GetProcedureRemarkII(isFilter, point) {
                var actionUrl = '<%=Url.Action("ProcedureRemarkIIProcess","Access") %>'
                $.ajax({
                    type: "GET",
                    url: actionUrl,
                    contentType: "application/json; charset=utf-8",
                    data: ({ isFitter: isFilter }),
                    success: function (data) {

                        $("#ProcedureRemarkII").html(data);

                        if (point < 1) {
                            $('#ProcedureRemarksII').removeAttr("disabled");
                        }
                    },
                    error: function (data) {
                        alert(data);
                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                    }
                });
            }

            function GetProcedureRemarkIII(isFilter, point) {
                var actionUrl = '<%=Url.Action("ProcedureRemarkIIIProcess","Access") %>'
                $.ajax({
                    type: "GET",
                    url: actionUrl,
                    contentType: "application/json; charset=utf-8",
                    data: ({ isFitter: isFilter }),
                    success: function (data) {

                        $("#ProcedureRemarkIII").html(data);

                        if (point < 1) {
                            $('#ProcedureRemarksIII').removeAttr("disabled");
                        }
                    },
                    error: function (data) {
                        alert(data);
                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                    }
                });
            }

            function GetProcedureRemarkIV(isFilter, point) {
                var actionUrl = '<%=Url.Action("ProcedureRemarkIVProcess","Access") %>'
                $.ajax({
                    type: "GET",
                    url: actionUrl,
                    contentType: "application/json; charset=utf-8",
                    data: ({ isFitter: isFilter }),
                    success: function (data) {

                        $("#ProcedureRemarkIV").html(data);

                        if (point < 1) {
                            $('#ProcedureRemarksIV').removeAttr("disabled");
                        }
                    },
                    error: function (data) {
                        alert(data);
                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                    }
                });
            }

            function GetProcedureRemarkV(isFilter, point) {
                var actionUrl = '<%=Url.Action("ProcedureRemarkVProcess","Access") %>'
                $.ajax({
                    type: "GET",
                    url: actionUrl,
                    contentType: "application/json; charset=utf-8",
                    data: ({ isFitter: isFilter }),
                    success: function (data) {

                        $("#ProcedureRemarkV").html(data);

                        if (point < 1) {
                            $('#ProcedureRemarksV').removeAttr("disabled");
                        }
                    },
                    error: function (data) {
                        alert(data);
                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                    }
                });
            }
        });
    </script>
    <h2>
        PROCEDURE ขั้นตอนการล้างจาน</h2>
    <% using (Html.BeginForm())
       {%>
    <%= Html.ValidationSummary(true) %>
    <div class="CSSTableGenerator">
        <table>
            <tr>
                <th>
                    <label>
                        PROCEDURE ขั้นตอนการล้างจาน</label>
                </th>
                <th>
                    <label>
                        OK ดี</label>
                </th>
                <th>
                    <label>
                        Remarks หมายเหตุ</label>
                </th>
                <th>
                    <label>
                        Point คะแนน</label>
                </th>
            </tr>
            <tr>
                <td>
                    <label>
                        Prescrapping การปาดเศษอาหาร</label>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ProcedureCheckI, new { @checked = "checked" })%>
                </td>
                <td>
                    <%--<%=@Html.DropDownListFor(model => model.ProcedureRemarksI, Model.ProcedureRemarkISelect)%>--%>
                     <div id="ProcedureRemarkI">
                        
                    </div>
                </td>
                <td align="center">
                    <%=@Html.TextBoxFor(model=>model.ProcedureRemarkPointI,new{@Value="1",@readonly="true"}) %>
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Racking การเรียงจาน/ภาชนะ/ช้อนลงกระบะ</label>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ProcedureCheckII)%>
                </td>
                <td>
                   <%-- <%=@Html.DropDownListFor(model => model.ProcedureRemarksII, Model.ProcedureRemarkIISelect)%>--%>
                    <div id="ProcedureRemarkII">
                        
                    </div>
                </td>
                <td align="center">
                    <%=@Html.TextBoxFor(model=>model.ProcedureRemarkPointII,new{@Value="1",@readonly="true"}) %>
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Machine Set up/Cleaning การติดตั้ง/ทำความสะอาดเครื่องล้างจาน</label>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ProcedureCheckIII)%>
                </td>
                <td>
                   <%-- <%=@Html.DropDownListFor(model => model.ProcedureRemarksIII, Model.ProcedureRemarkIIISelect)%>--%>
                   <div id="ProcedureRemarkIII">
                        
                    </div>
                </td>
                <td align="center">
                    <%=@Html.TextBoxFor(model=>model.ProcedureRemarkPointIII,new{@Value="1",@readonly="true"}) %>
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Flatware Presoaking การแช่ มีด/ช้อน/ซ่อม</label>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ProcedureCheckIV)%>
                </td>
                <td>
                   <%-- <%=@Html.DropDownListFor(model => model.ProcedureRemarksIV, Model.ProcedureRemarkIVSelect)%>--%>
                   <div id="ProcedureRemarkIV">
                        
                    </div>
                </td>

                <td align="center">
                    <%=@Html.TextBoxFor(model=>model.ProcedureRemarkPointIV,new{@Value="1",@readonly="true"}) %>
                </td>
            </tr>
            <tr>
                <td>
                    <label>
                        Change Tank Water การเปลี่ยนน้ำใหม่</label>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ProcedureCheckV)%>
                </td>
                <td>
                  <%--  <%=@Html.DropDownListFor(model => model.ProcedureRemarksV, Model.ProcedureRemarkVSelect)%>--%>
                    <div id="ProcedureRemarkV">
                        
                    </div>
                </td>
                <td align="center">
                    <%=@Html.TextBoxFor(model=>model.ProcedureRemarkPointV,new{@Value="1",@readonly="true"}) %>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    Total Points คะแนนรวม
                </td>
                <td>
                    <input type="text" id="TotalPoint" readonly="readonly" value="0" />
                </td>
            </tr>
        </table>
    </div>
    <p>
        <input type="submit" class="buttonSummit" value="Next" />
    </p>
    <% } %>
    <div>
        <%= Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
